package calorie.com.calorie.contact;


import com.lxh.baselibray.mvp.BasePresent;
import com.lxh.baselibray.mvp.IBaseView;
import com.lxh.baselibray.net.NetCallBack;
import com.lxh.baselibray.net.ServiceGenerator;


import calorie.com.calorie.api.ApiService;
import calorie.com.calorie.request.BaseRequest;
import calorie.com.calorie.response.ResultDTO;
import retrofit2.Call;
import retrofit2.Response;

public  class ModifyLoginPwdContact  {
    public static class ModifyLoginPwdPresent extends BasePresent<IModifyLoginPwd>{
        public void modifyLoginPwd(Integer userId,String oldPassword,String  newPassword){
            BaseRequest request = new BaseRequest();
            request.put("userId",userId);
            request.put("oldPassword",oldPassword);
            request.put("newPassword",newPassword);//newPassword
            ApiService service = ServiceGenerator.createService(ApiService.class);
            service.updateLoginPassword(request).enqueue(new NetCallBack<ResultDTO>() {
                @Override
                public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) {
                    if(getView()!=null){
                        getView().getUpdatePassword(response);
                    }
                }

                @Override
                public void onFailed() {

                }
            });
        }
    }




    public interface  IModifyLoginPwd extends IBaseView {
          void getUpdatePassword(Response<ResultDTO> resultDTOResponse);
    }
}
